Exceptions returned from OPC UA operations of QuickOPC can be
A comprehensive list of possible errors cannot be given. Your program must always be ready to handle any error that it does not explicitly know about. In most cases, you will be treating all errors the same way. In some cases, you may need to have a special handling for one or a few specific errors.
OPC UA services indicate the outcome of the operation using service results. In QuickOPC, when the OPC UA server returns a service result that denotes an error, you will receive a UAServiceException. This object contains, among other information, a ServiceResult Property. You can use this property to distinguish between the specific errors. The value it contains is actually of the UAServiceResult type, and is further structured into various fields. In most cases, however, you are only interested in the so-called code bits (an integer) of the status code associated with the service result. The various code bits defined in the OPC UA specifications are available to you as predefined constants in the UACodeBits Class. For example, there is BadNodeIdUnknown Field, BadNotReadable Field, BadNotWritable Field etc. The UAServiceResult Class has an implicit conversion operator to an integer, which returns the code bits of the service result. This means that in order to test the UAServiceException for a specific error, you can simply take its ServiceResult Property, and compare it against the desired constant from the UACodeBits Class.
Note: The error texts are for illustration only. They are subject to change without notice. Your program should never rely on the error texts; use the exception type, and possibly other properties of the specific exception types, to distinguish between the errors.
The errors in this case vary a lot, depending on factors such as the communication protocol used, or the actual configuration of the target host (when accessible, whether it drops or returns incoming packets that it does not process, etc.). You may receive e.g.:
Of course, the true cause of the exception may be that the intended host is actually running and accessible, but you have misspelled its name or IP address.
The symptoms are in many cases similar as when the remote host cannot be reached.
In this case, you will typically receive a UAServiceException with service result "BadNodeIdUnknown".
Of course, you will get the same exception if the intended node actually exists, but you have made a mistake in its Node ID.
In this case, you will typically receive a UAServiceException with service result "BadNotReadable" or "BadNotWritable".
The methods that do not have data quality in their results, and therefore must return an error instead of the value when the value is not present, include: